<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
header("content-type:text/html;charset=UTF-8");
//进行连接数据库操作
include_once('../DB.php');
$DB =  new DB();

//查询转盘信息
$res_list = $DB->get_all("select * from guaguaka");

//获取操作信息
$action=$_GET["action"];
//是否删除
if($action=="del")
{
    //获取ID号
    $id=intval($_GET["id"]);
    //获取当前时间
    //$nowtime=date("Y/m/d H:i:s",time());
    $DB->delete("guaguaka","id =  {$id}");
	//$mysql->runSql("update class set status=0,edittime='$nowtime' where class_id=$class_id");    
   echo "<script>alert('操作成功！');location='guaguaka_list.php';</Script>";
   exit;    
}  

?>
<b>大转盘活动详细信息</b>
<table border=1>
        <tr>
            <td>序号</td><td>关键字</td><td>活动名称</td><td>兑奖信息</td><td>活动状态</td>
            <td>活动添加时间</td><td>活动结束时间</td><td>回复状态</td>
            <td>一等奖奖品名称</td><td>一等奖奖品数量</td><td>二等奖奖品名称</td><td>二等奖奖品数量</td>
            <td>三等奖奖品名称</td><td>三等奖奖品数量</td>  
            <td>删除</td><td>修改</td>
        </tr>
        <?php
            if($res_list)
            {
                $addTime = date('Y-m-d',$value[addTime]);
                $endTime = date('Y-m-d',$value[endTime]);
                foreach($res_list as $value)
                {
                
                    echo "<tr>
                          <td>$value[id]</td>
                          <td>$value[guaguaka_key]</td>
                          <td>$value[guaguaka_name]</td>
                          <td>$value[guaguaka_info]</td>
                          <td>$value[guaguaka_status]</td>
                          <td>$addTime</td>
                          <td>$endTime</td>
                          <td>$value[reply_status]</td>
                          <td>$value[first_name]</td>
                          <td>$value[first_number]</td>
                          <td>$value[second_name]</td>
                          <td>$value[second_number]</td>
                          <td>$value[third_name]</td>
                          <td>$value[third_number]</td>
                              
                          <td><a href='guaguaka_list.php?action=del&id=$value[id]'>删除</a></td>
                          <td><a href='guaguaka_add.php?action=update&id=$value[id]'>修改</a></td>
                                              
                          <tr>";
                }
            }
            else
            {
			
                echo "<tr><td colspan=4>无记录</td></tr>";
            }
        ?>
    
    </table>
